'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ACCTADM 8 "April 9, 2016"
.SH NAME
acctadm \- configure extended accounting facility
.SH SYNOPSIS
.LP
.nf
\fB/usr/sbin/acctadm\fR [\fB-DEsrux\fR] [\fB-d\fR \fIresource_list\fR]
     [\fB-e\fR \fIresource_list\fR] [\fB-f\fR \fIfilename\fR]
     [task | process | flow | net]
.fi

.SH DESCRIPTION
.LP
\fBacctadm\fR configures various attributes of the extended accounting
facility. Without arguments, \fBacctadm\fR displays the current status of the
extended accounting facility.
.SH OPTIONS
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-d\fR \fIresource_list\fR\fR
.ad
.sp .6
.RS 4n
Disable reporting of resource usage for resource. Specify \fIresource_list\fR
as a comma-separated list of resources or resource groups.
.sp
This option requires an operand. See \fBOPERANDS\fR.
.RE

.sp
.ne 2
.na
\fB\fB-D\fR\fR
.ad
.sp .6
.RS 4n
Disable accounting of the given operand type without closing the accounting
file. This option can be used to temporarily stop writing accounting records to
the accounting file without closing it. To close the file use the \fB-x\fR
option. See \fB-x\fR.
.RE

.sp
.ne 2
.na
\fB\fB-e\fR \fIresource_list\fR\fR
.ad
.sp .6
.RS 4n
Enable reporting of resource usage for resource. Specify \fIresource_list\fR as
a comma-separated list of resources or resource groups.
.sp
This option requires an operand. See \fBOPERANDS\fR.
.RE

.sp
.ne 2
.na
\fB\fB-E\fR\fR
.ad
.sp .6
.RS 4n
Enable accounting of the given operand type without sending the accounting
output to a file. This option requires an operand. See \fBOPERANDS\fR.
.RE

.sp
.ne 2
.na
\fB\fB-f\fR \fIfilename\fR\fR
.ad
.sp .6
.RS 4n
Send the accounting output for the given operand type to \fIfilename\fR. If
\fIfilename\fR exists, its contents must be of the given accounting type.
.sp
This option requires an operand. See \fBOPERANDS\fR.
.RE

.sp
.ne 2
.na
\fB\fB-r\fR\fR
.ad
.sp .6
.RS 4n
Display available resource groups.
.sp
When this option is used with an operand, it displays resource groups available
for a given accounting type. When no operand is specified, this option displays
resource groups for all available accounting types. See OPERANDS.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR\fR
.ad
.sp .6
.RS 4n
Start method for the \fBsmf\fR(7) instance. This option is used to restore the
extended accounting configuration at boot.
.RE

.sp
.ne 2
.na
\fB\fB-x\fR\fR
.ad
.sp .6
.RS 4n
Deactivate accounting of the given operand type. This option also closes the
accounting file for the given accounting type if it is currently open.
.sp
This option requires an operand. See \fBOPERANDS\fR.
.RE

.SH OPERANDS
.LP
The \fB-d\fR, \fB-D\fR, \fB-e\fR, \fB-E\fR, \fB-f\fR, and \fB-x\fR options
require an operand.
.sp
.LP
The following operands are supported:
.sp
.ne 2
.na
\fB\fBprocess\fR\fR
.ad
.sp .6
.RS 4n
Run \fBacctadm\fR on the process accounting components of the extended
accounting facility.
.RE

.sp
.ne 2
.na
\fB\fBtask\fR\fR
.ad
.sp .6
.RS 4n
Run \fBacctadm\fR on the task accounting components of the extended accounting
facility.
.RE

.sp
.ne 2
.na
\fB\fBflow\fR\fR
.ad
.sp .6
.RS 4n
Run \fBacctadm\fR on the IPQoS accounting components of the extended accounting
facility.
.RE

.sp
.ne 2
.na
\fB\fBnet\fR\fR
.ad
.sp .6
.RS 4n
Run \fBacctadm\fR on links and flows administered by \fBdladm\fR(8) and
\fBflowadm\fR(8), respectively. Basic network accounting relates only to
links, while extended network accounting includes both link and flow
accounting.
.RE

.sp
.LP
The optional final parameter to \fBacctadm\fR represents whether the command
should act on the process, system task, IPQoS, or network accounting components
of the extended accounting facility.
.SH EXAMPLES
.LP
\fBExample 1 \fRDisplaying the Current Status
.sp
.LP
The following command displays the current status. In this example, system task
accounting is active and tracking only \fBCPU\fR resources. Process and flow
accounting are not active.

.sp
.in +2
.nf
$ \fBacctadm\fR
            Task accounting: active
       Task accounting file: /var/adm/exacct/task
     Tracked task resources: extended
   Untracked task resources: host
         Process accounting: inactive
    Process accounting file: none
  Tracked process resources: none
Untracked process resources: extended,host
            Flow accounting: inactive
       Flow accounting file: none
     Tracked flow resources: none
   Untracked flow resources: extended
             Net accounting: inactive
        Net accounting file: none
      Tracked Net resources: none
    Untracked Net resources: extended
.fi
.in -2
.sp

.LP
\fBExample 2 \fRActivating Basic Process Accounting
.sp
.LP
The following command activates basic process accounting:

.sp
.in +2
.nf
$ \fBacctadm -e basic -f /var/adm/exacct/proc process\fR
.fi
.in -2
.sp

.LP
\fBExample 3 \fRDisplaying Available Resource Groups
.sp
.LP
The following command displays available resource groups:

.sp
.in +2
.nf
$ \fBacctadm -r\fR
  process:
  extended pid,uid,gid,cpu,time,command,tty,projid, \e
  taskid,ancpid,wait-status,zone,flag,memory,mstate
  basic    pid,uid,gid,cpu,time,command,tty,flag
  task:
  extended taskid,projid,cpu,time,host,mstate,anctaskid,zone
  basic    taskid,projid,cpu,time
  flow:
  extended saddr,daddr,sport,dport,proto,dsfield,nbytes,npkts, \e
  action,ctime,lseen,projid,uid
  basic    saddr,daddr,sport,dport,proto,nbytes,npkts,action
  net:
  extended name,devname,edest,vlan_tpid,vlan_tci,sap,cpuid, \e
  priority,bwlimit,curtime,ibytes,obytes,ipkts,opks,ierrpkts \e
  oerrpkts,saddr,daddr,sport,dport,protocol,dsfield
  basic    name,devname,edest,vlan_tpid,vlan_tci,sap,cpuid, \e
  priority,bwlimit,curtime,ibytes,obytes,ipkts,opks,ierrpkts \e
  oerrpkts
.fi
.in -2
.sp

.sp
.LP
In the output above, the lines beginning with \fBextended\fR are shown with a
backslash character. In actual \fBacctadm\fR output, these lines are displayed
as unbroken, long lines.

.LP
\fBExample 4 \fRDisplaying Resource Groups for Task Accounting
.sp
.LP
The following command displays resource groups for task accounting:

.sp
.in +2
.nf
$ \fBacctadm -r task\fR
  extended taskid,projid,cpu,time,host,mstate,anctaskid,zone
  basic    taskid,projid,cpu,time
.fi
.in -2
.sp

.SH EXIT STATUS
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.sp .6
.RS 4n
Successful completion.
.sp
The modifications to the current configuration were valid and made
successfully.
.RE

.sp
.ne 2
.na
\fB\fB1\fR\fR
.ad
.sp .6
.RS 4n
An error occurred.
.sp
A fatal error occurred either in obtaining or modifying the accounting
configuration.
.RE

.sp
.ne 2
.na
\fB\fB2\fR\fR
.ad
.sp .6
.RS 4n
Invalid command line options were specified.
.RE

.sp
.ne 2
.na
\fB\fB95\fR\fR
.ad
.sp .6
.RS 4n
A fatal, non-configuration error occurred during the start of the \fBsmf\fR(7)
service instance.
.RE

.sp
.ne 2
.na
\fB\fB96\fR\fR
.ad
.sp .6
.RS 4n
A fatal configuration error occurred during the start of the \fBsmf\fR(7)
service instance.
.RE

.SH ATTRIBUTES
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
.TE

.SH SEE ALSO
.LP
.BR acct (2),
.BR ipqos (4IPP),
.BR attributes (7),
.BR smf (7),
.BR dladm (8),
.BR flowadm (8)
.SH NOTES
.LP
Both extended accounting and regular accounting can be active.
.sp
.LP
Available resources can vary from system to system, and from platform to
platform.
.sp
.LP
Extended accounting configuration is stored in the service management facility
(\fBsmf\fR(7)) repository. The configuration is restored at boot by a transient
service instance, one per accounting type:
.sp
.in +2
.nf
svc:/system/extended-accounting:flow        Flow accounting
svc:/system/extended-accounting:process     Process accounting
svc:/system/extended-accounting:task        Task accounting
svc:/system/extended-accounting:net         Network accounting
.fi
.in -2
.sp

.sp
.LP
The instances are enabled or disabled by \fBacctadm\fR as needed. Configuration
changes are made using \fBacctadm\fR; service properties should not be modified
directly using \fBsvccfg\fR(8).
.sp
.LP
Users can manage extended accounting (start accounting, stop accounting, change
accounting configuration parameters) if they have the appropriate RBAC Rights
profile for the accounting type to be managed:
.RS +4
.TP
.ie t \(bu
.el o
Extended Accounting Flow Management
.RE
.RS +4
.TP
.ie t \(bu
.el o
Extended Accounting Process Management
.RE
.RS +4
.TP
.ie t \(bu
.el o
Extended Accounting Task Management
.RE
.RS +4
.TP
.ie t \(bu
.el o
Extended Accounting Network Management
.RE
.sp
.LP
The preceding profiles are for, respectively, flow accounting, process
accounting, task accounting, and network accounting.
